//
//  TMJsonParser.h
//  TelethonMobile
//
//  Created by Cyril ALIX on 03/12/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Lieu.h"
#import "Constant.h"


@protocol TMServerApiDelegate <NSObject>

- (void) finishWithData:(NSArray*)theArray;

@end

@interface TMServerApi : NSObject

@property (nonatomic, assign) id<TMServerApiDelegate> delegate;

- (void) fetchLocationsWithDistance: (float)distance andLongitude : (float)longitude andLatitude : (float)latitude andDelegate:(id)sender;
- (void) fetchLocationsWithDistance:(float)distance andLongitude:(float)longitude andLatitude:(float)latitude filterByCategory:(int)categorie andDelegate:(id)sender;
- (void) insertLocation:(Lieu*) leLieu;

#pragma mark -
#pragma mark singleton
+ (TMServerApi *)sharedInstance;

#pragma mark -
#pragma mark delegatefunctions
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;


@end
